<!--
 * @FilePath     : /study_code/css/float4.html
 * @Description  : float 用于解决多个块级元素需要在一行显示的问题
 * @Date         : 2025-04-27 10:13:48
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-27 10:13:49
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
    <style>
      .parent {
        border: 1px solid red;
      }

      .box {
        width: 40px;
        height: 40px;
      }

      .a1 {
        background-color: lightcoral;
      }

      .b1 {
        background-color: lightseagreen;
      }

      .fl {
        float: left;
      }
    </style>
  </head>

  <body>
    <div class="parent">
      <div class="box a1">A1</div>
      <div class="box b1">B1</div>
    </div>
    <hr />
    <div class="parent">
      <div class="box a1 fl">A1</div>
      <div class="box b1 fl">B1</div>
    </div>
    <p>这时 块级元素就在一行显示了（但都浮动 父容器高度会塌陷，推荐使用 flex 弹性盒子布局）</p>
    <script></script>
  </body>
</html>
